package com.qingke.oo.Set;

public class Dog implements Comparable<Dog>{

	private String name;
	private String owner;
	private int age;

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public Dog(String name, String owner) {
		this.name = name;
		this.owner = owner;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getOwner() {
		return owner;
	}

	public void setOwner(String owner) {
		this.owner = owner;
	}

	public String toString() {
		return name + ":" + owner;
	}

	public boolean equals(Object object) {
		if (!(object instanceof Dog))
			return false;
		Dog d = (Dog) object;
		return name.equals(d.name) && owner.equals(d.owner);
	}

	public int hashCode() {
		String s = owner + name;
		return s.hashCode();
	}

	

	@Override
	public int compareTo(Dog o) {
		// TODO Auto-generated method stub
		return name.compareTo(o.name);
		
		 
	}
	
	
}
